/*
 * =====================================================================================
 *
 *       Filename:  cl_common_defs.cxx
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  03/24/2011 03:01:35 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Ken Chen (Ken), chen_kenz@emc.com
 *        Company:  EMC
 *
 * =====================================================================================
 */

#include <sys/socket.h>
#include <cassert>
#include "cl_common_defs.hxx"

namespace neo
{
using namespace std;

int clSocketTypeToNativeType(CLSocketType type)
{
  switch(type)
  {
    case CL_SOCK_STREAM:
      return ::SOCK_STREAM;
      break;

    case CL_SOCK_DGRAM:
      return ::SOCK_DGRAM;
      break;

    default:
      return 0;
      break;
  }
}

int clConnCloseTypeToNativeType(CLConnCloseType type) 
{
  switch(type)
  {
    case CL_SHUT_RD:
      return ::SHUT_RD;
      break;

    case CL_SHUT_WR:
      return ::SHUT_WR;
      break;

    case CL_SHUT_RDWR:
    default:
      return ::SHUT_RDWR;
      break;
  }
}

} // neo

